import 'package:flutter/material.dart';
import 'package:flutter_frame/app/modules/home/face/face_view.dart';
import 'package:flutter_frame/app/modules/home/object/object_detector_view.dart';
import 'package:flutter_frame/app/modules/home/profile/controller.dart';
import 'package:flutter_frame/app/modules/home/profile/page1.dart';
import 'package:flutter_frame/app/modules/home/tree/tree_view.dart';
import 'package:flutter_frame/app/modules/home/video/video.dart';
import 'package:get/get.dart';

class ProfilePage extends StatelessWidget {
  const ProfilePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final controller = Get.put(ProfileController());
    return GetBuilder<ProfileController>(
      builder: (_) {
        return SafeArea(
          child: DefaultTabController(
            length: 3,
            child: Scaffold(
              appBar: AppBar(
                bottom: const TabBar(
                  tabs: [
                    Tab(
                      icon: Icon(Icons.home),
                    ),
                    Tab(
                      icon: Icon(Icons.video_collection_rounded),
                    ),
                    Tab(
                      icon: Icon(Icons.settings),
                    ),
                  ],
                ),
              ),
              body: TabBarView(
                children: [
                  Center(
                    child: SingleChildScrollView(
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          // ElevatedButton(onPressed: controller.test4, child: const Text('二维码检测')),
                          ElevatedButton(onPressed: controller.canvasRabbitWidget, child: const Text('图形绘制兔子')),
                          ElevatedButton(onPressed: controller.cao, child: const Text('webrtc')),
                          ElevatedButton(
                              onPressed: () {
                                Get.to(VideoPlayer.new);
                              },
                              child: const Text('视频测试')),
                          ElevatedButton(
                              onPressed: () {
                                Get.to(FacePage.new);
                              },
                              child: const Text('边缘人脸识别测试')),
                          ElevatedButton(
                              onPressed: () {
                                Get.to(ObjectDetectorView.new);
                              },
                              child: Text('物体识别')),
                          ElevatedButton(
                              onPressed: () {
                                Get.to(TreePage.new);
                              },
                              child: Text('树形结构')),
                        ],
                      ),
                    ),
                  ),
                  const Dispatch(),
                  Container(),
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}
